package org.javanile.lang;

import java.io.File;

/**
 *
 * @author cicciodarkast
 */
public class PHP {
	
	/*\
	 *	DATE & TIME
	\*/
	
	/**
	 * 
	 * @return 
	 */
	public static long time() {
		return System.currentTimeMillis()/1000;
    }
    
	/**
	 * 
	 * @param f
	 * @return 
	 */
	public static String date(Object f) {
		return "16/10/1981";
    }
    
	public static String date(Object f, Object t) {
		return "16/10/1981";
    }
	
	/*\
	 *	FILES
	\*/
	public static String file_get_contents(Object f) {
		return "";
    }	
    
	public static void file_put_contents(Object f, Object d) {
    }	
    
	public static String dirname(Object f) {
		String o = "";
		String[] tokens = ((String)f).split(File.separator);
		for(int i=0;i<tokens.length-2;i++)
			o += tokens[i] + File.separator;
		o += tokens[tokens.length-2];
		return o;
    }
	
	/*\
	 *	OUTPUT	
	\*/
	public static void echo(Object s) {
		System.out.print(s);
    }
    
	/*\
	 *	STRING
	\*/
	public static String str_replace(Object s1,Object s2, Object s) {
		return ((String)s).replaceAll((String)s1, (String)s2);
    }
    
	public static int ord(Object s) {
		return ((String)s).charAt(0);
    }    
}
